package jp.co.lkg.springsmp.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import jp.co.lkg.springsmp.common.Page;
import jp.co.lkg.springsmp.common.dao.FlowerinfoDao;
import jp.co.lkg.springsmp.common.db.dto.FlowerinfoDto;
import jp.co.lkg.springsmp.services.FlowerinfoService;


@Component
public class FlowerinfoServiceImpl implements FlowerinfoService {

	
	
	@Autowired
    private FlowerinfoDao flowerinfoDao;

	@Override
	public FlowerinfoDto selectByPk(FlowerinfoDto dto) {
		
		return flowerinfoDao.selectByPk(dto);
	}

	@Override
	public List<FlowerinfoDto> select(FlowerinfoDto dto) {
		// TODO Auto-generated method stub
		return flowerinfoDao.select(dto);
	}

	@Override
	public void insert(FlowerinfoDto dto) {
		flowerinfoDao.insert(dto);
		
	}

	@Override
	public void updateByPk(FlowerinfoDto dto) {
		// TODO Auto-generated method stub
		flowerinfoDao.updateByPk(dto);
		
	}

	@Override
	public void deleteByPk(FlowerinfoDto dto) {
		// TODO Auto-generated method stub
		flowerinfoDao.deleteByPk(dto);
		
	}

	@Override
	public void updateIncludeNull(FlowerinfoDto dto) {
		// TODO Auto-generated method stub
		flowerinfoDao.updateIncludeNull(dto);
		
	}

	@Override
	public Page selectPage(Integer currPage, FlowerinfoDto dto) {
		// TODO Auto-generated method stub
		Page page =new Page();
		if(currPage==null) currPage=1;
		page.setCurrPage(currPage);
		int Count =flowerinfoDao.selectAllPage();
		page.setTotalSize(Count);
		page.initTotalPage();
		page.setMinnumber(currPage);
		page.setMaxnumber(currPage);
		dto.setMaxnumber(page.getMaxnumber());
		dto.setMinnumber(page.getMinnumber());
		page.setFlowerlist(flowerinfoDao.selectAllFlower(dto));
		return page;
	}

	@Override
	public List<FlowerinfoDto> selectAllFlower(FlowerinfoDto dto) {
		// TODO Auto-generated method stub
		return flowerinfoDao.selectAllFlower(dto);
	}

	@Override
	public List<FlowerinfoDto> selectByName(String flowerName) {
		// TODO Auto-generated method stub
		return flowerinfoDao.selectByName(flowerName);
	}

	

}
